import Vue from "vue";
import VueRouter from "vue-router";
import Home from "../views/Home.vue";

Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    name: "Home",
    component: Home
  },
  {
    path: "/tlj",
    name: "Tlj",
    redirect: "/tlj/homepage",
    component: () =>
      import(/* webpackChunkName: "Tlj" */ "@/views/tlj/index.vue"),
    meta: {
      title: "首单礼金",
      showtab: false
    },
    children: [
      {
        path: "homepage",
        name: "homepage",
        component: () => import("@/views/tlj/homepage/index.vue"),
        meta: {
          title: "首页"
        }
      }
    ]
  },
  {
    path: "/user",
    name: "User",
    redirect: "/user/login.vue",
    component: () =>
      import(/* webpackChunkName: "Tlj" */ "@/views/user/index.vue"),
    meta: {
      title: "用户登录",
      showtab: false
    },
    children: [
      {
        path: "login",
        name: "login",
        component: () => import("@/views/user/login.vue"),
        meta: {
          title: "登录"
        }
      },
      {
        path: "forgetpass",
        name: "forgetpass",
        component: () => import("@/views/user/forgetpass.vue"),
        meta: {
          title: "忘记密码"
        }
      },
      {
        path: "register",
        name: "register",
        component: () => import("@/views/user/register.vue"),
        meta: {
          title: "注册"
        }
      }
    ]
  },
  {
    path: "/about",
    name: "About",
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () =>
      import(/* webpackChunkName: "about" */ "../views/About.vue")
  }
];

const router = new VueRouter({
  mode: "history",
  base: process.env.BASE_URL,
  routes
});

export default router;
